#!/bin/bash
#Android Download Project
#自動分批下載android/project,如果停止就按ctrl+c
#重新執行可以斷點傳輸
#android_dlproj.sh .repo/manifest.xml
declare -a projnames
tmp=`sed -n -e 's/<project //' -e 's/\/>//p' $1 | sed -e  's/path="//' -e 's/name="//' -e 's/"//g'`
projs=($(echo $tmp))

for((i=0, j=0; i<${#projs[*]}; i++, j++))
do
   projnames[j]=${projs[++i]}
done

#exe the repo sync, at your directory contain .repo
cd $HOME/mydroid
pwd
for((k=0; k<${#projnames[*]}; k++))
do
   echo "projnames: ${projnames[k]}"
   repo sync ${projnames[k]}
done
